home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Die Speccy' 97
/
Die Speccy' 97.iso
/
amiga_system
/
the_aminet
/
util
/
wb
/
membar.lha
/
membar
/
Membar.mod
Wrap
Text File
|
1995-10-01
|
4KB
|
180 lines
(***************************************************************************
MODUL
Membar.mod
DESCRIPTION
Displays actual memory usage in a small window.
NOTES
Membar is the Oberon-2 version of the Membar tool by
Andreas Tetzl <A.Tetzl@saxonia.de>.
Membar is simply Freeware. You may use it for free but not for
any military subject.
This software comes with absolutely no warranty. Every use at
your own risk. I am not responsible for any damage caused direkt
or indirekt by this program. It works fine for me, that is all.
This version is compiled using Oberon-A.
OC version: 5.37
BUGS
sure
TODO
tell me
EXAMPLES
Just run it and it will open its window.
End with doubleklick in the window.
SEE ALSO
Have a look at the titlebar of your WB. ;)
INDEX
HISTORY
30-09-95 Roland (rj,-) Jesse created
***************************************************************************)
<* STANDARD- *> (* necessary for assignable cleanup procedure *)
MODULE Membar;
IMPORT
MembarRev,
Errors, Kernel,
d := Dos,
e := Exec,
gfx := Graphics,
i := Intuition,
S := SYSTEM,
s := Sets,
u := Utility;
TYPE
String = ARRAY 256 OF CHAR;
CONST
(* color definitions *)
BACKCOL = 2;
FULLCOL = 3;
EMPTYCOL = 0;
BARWIDTH = 150;
VAR
win : i.WindowPtr;
scr : i.ScreenPtr;
rp : gfx.RastPortPtr;
(* storing the various memory values *)
mem, oldmem, total : LONGINT;
(* kind of memory for e.AvailMem *)
mask : s.SET32;
mask2 : s.SET32;
sec, mic : LONGINT;
msg : i.IntuiMessagePtr;
(* Doubleklick in the window ? *)
CheckBreak : BOOLEAN;
(* displays EasyRequester with argument string *)
PROCEDURE Req (text: String);
VAR
es : i.EasyStruct;
pushed : LONGINT;
BEGIN
es.structSize := SIZE (i.EasyStruct);
es.flags := {};
es.title := S.ADR ("Membar Information");
es.textFormat := S.ADR (text);
es.gadgetFormat := S.ADR ("OK");
pushed := i.EasyRequest ( NIL, S.ADR (es), NIL, NIL );
END Req;
(* open all needed stuff *)
PROCEDURE Init;
BEGIN
scr := i.LockPubScreen ("Workbench");
IF scr = NIL THEN
Req ("CANT FIND WB");
HALT (d.error)
END;
win := i.OpenWindowTagsA ( NIL,
i.waLeft, scr.width - BARWIDTH - 26,
i.waTop, 0,
i.waWidth, BARWIDTH,
i.waHeight, scr.barHeight,
i.waBorderless, TRUE,
i.waIDCMP, i.menuPick,
u.done );
IF win = NIL THEN
Req ("Can't open window");
HALT (d.error)
END;
rp := win.rPort;
gfx.SetRast (rp, S.VAL (e.UBYTE, BACKCOL));
mask := {e.total};
total := e.AvailMem (mask);
sec := 0; mic := 0; oldmem := 0
END Init;
(* Remove all the allocated stuff *)
PROCEDURE* Cleanup (VAR rc : LONGINT);
BEGIN
IF win # NIL THEN i.CloseWindow (win) END
END Cleanup;
BEGIN (* MemBar *)
Errors.Init;
Kernel.SetCleanup (Cleanup);
Init;
CheckBreak := FALSE;
REPEAT
mask := {e.chip}; mask2 := {e.fast};
mem := total - e.AvailMem (mask) - e.AvailMem (mask2);
IF ABS (mem - oldmem) > 1024 THEN
gfx.SetAPen (rp, EMPTYCOL);
gfx.RectFill (rp, 1, 2, win.width-2, win.height-3);
gfx.SetAPen (rp, FULLCOL);
gfx.RectFill (rp, 1, 2, S.VAL (INTEGER, (win.width-2) * mem DIV total), win.height-3);
END;
oldmem := mem;
d.Delay(50);
msg := S.VAL (i.IntuiMessagePtr, e.GetMsg (win.userPort));
IF msg # NIL THEN
IF i.DoubleClick (sec, mic, msg.time.secs, msg.time.micro) THEN
e.ReplyMsg (msg);
HALT (d.ok)
END;
e.ReplyMsg (msg);
sec := msg.time.secs;
mic := msg.time.micro
END;
UNTIL CheckBreak = TRUE;
END Membar.